﻿; (function (window, undefined, $) {
    var submiting = false;
    $('#frmEdit').validator({
        rules: {

        },
        fields: {
            '#Name': 'required',
            '#ParentId': 'required',
            '#Remar': 'required',
        },
        valid: function (form) {
            if (submiting) {
                return;
            }
            submiting = true;
            FormSubmit(form, function (res) {
                if (res.Status > 0) {
                    alert(res.Message);
                    window.location.href = "/Admin/ProjectMgr/ProjectOrderList/" + $("#hideProjectId").val();
                }
                else {
                    alert(res.Message);
                }
                submiting = false;
            })
        }
    });

    $("#btnSave").click(function (e) {
        $("#frmEdit").submit();
    });

    $("#btnReturn").click(function (e) {
        window.location.href = "/Admin/ProjectMgr/ProjectOrderList/" + $("#hideProjectId").val();
    });

})(window, undefined, jQuery);